<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="../../lib/html5shiv.js?rev=@@hash"></script>
    <script type="text/javascript" src="../../lib/respond.min.js?rev=@@hash"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="../../static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="../../static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="../../lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="../../static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="../../static/h-ui.admin/css/style.css" />
    <link rel="stylesheet" type="text/css" href="../../ht-css/Project.css" />
    <!--企业logo组件-->
    <link rel="stylesheet" type="text/css" href="../../ht-css/contract/bullet.css" />
    <link rel="stylesheet" type="text/css" href="../../ht-css/contract/jquery.Jcrop.css" />
    <link rel="stylesheet" type="text/css" href="../../ht-css/contract/jquery.Jcrop.min.css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="../../lib/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title>合同管理</title>
</head>
<body>
<nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 客户管理
    <span class="c-gray en">&gt;</span> 合同管理
    <span class="c-gray en">&gt;</span> 客户基本信息编辑
</nav>
<article class="page-container">
    <form class="ml-20 mr-20" id="form-member-add"  method="post">
        <div class=" pd-5 bg-1 bk-gray" id="custoedit_list">
            <script id="custoedit_bob" type="text/x-dot-template">
            <div class="va-m pl-10 lh-50 f-17 f-16">
                <strong>客户基本信息</strong>
            </div>
            <table class="table-hover table_li ml-10">
                <thead class="text-l">
                <tr >
                    <td>
                        <span>客户ID: <span  class="text-overflow" style="width: 10px">{{=it.customer_id}}</span></span>
                    </td>
                    <td>
                        <span>合同号: <span>{{=it.contract_num}}</span></span>
                    </td>
                    <td>
                        <span>老系统合同号: <span>{{=it.customer_code}}</span></span>
                    </td>
                    <td>
                        <span>客户类型: <span class="text-overflow" style="width: 10px">{{=it.customer_type}}</span></span>
                    </td>
                    <td>
                        <span>客户名称: <span>{{=it.customer_name}}</span></span>
                    </td>
                    <td>
                        <span>采购商品简述: <span>{{=it.purchase_goods_intro}}</span></span>
                    </td>
                </tr>
                <tr >
                    <td colspan="2">
                        <div class="row ml-10">
                            <label class="form-label f-l" style="line-height: 2">合同状态：</label>
                            <select class="select radius" name="brandclass" size="1" style="width:50%; height: 30px;" id="state">
                                {{if( it.new_contract_state == 1 ){ }}
                                <option value="1" selected>正常</option>
                                <option value="2">冻结</option>
                                <option value="3">关闭</option>
                                {{ }else if( it.new_contract_state == 2 ){ }}
                                <option value="1">正常</option>
                                <option value="2" selected>冻结</option>
                                <option value="3">关闭</option>
                                {{ }else if( it.new_contract_state == 3){ }}
                                <option value="1">正常</option>
                                <option value="2">冻结</option>
                                <option value="3" selected>关闭</option>
                                {{ } }}
                            </select>
                        </div>
                    </td>
                    <td>
                        <span>合同类型: <span>{{=it.contract_type}}</span></span>
                    </td>
                    <td>
                        <span>申请时间: <span>{{=it.appr_date}}</span></span>
                    </td>
                    <td>
                        <span>签约时间: <span>{{=it. qy_create_date}}</span></span>
                    </td>
                    <td>
                        <span>合同有效期: <span>{{=it.con_end_date}}</span></span>
                    </td>
                </tr>
                <tr >
                    <td colspan="6" >
                        <label class="f-l">客户简介：</label>
                        <div class="formControls col-xs-8 col-sm-9 mt-10 mb-10">
                            <textarea name="abstract" class="textarea"  readonly="readonly" title="不可输入">{{=it.introduct}}</textarea>
                        </div>
                    </td>
                </tr>
                <tr >
                    <td>
                        <span>客户联系人: <span class="text-overflow" style="width: 10px">{{=it.linkman}}</span></span>
                    </td>
                    <td>
                        <span>职位: <span>{{=it.duty}}</span></span>
                    </td>
                    <td>
                        <span>客户地址: <span>{{=it.address}}</span></span>
                    </td>
                    <td>
                        <span>固话: <span>{{=it.office_phone}}</span></span>
                    </td>
                    <td>
                        <span>手机: <span>{{=it.mobile}}</span></span>
                    </td>
                    <td>
                        <span>邮箱: <span>{{=it.customer_email}}</span></span>
                    </td>
                </tr>
                <tr >
                    <td colspan="6" >
                        <span> 授权收货人: <span>{{=it.auth_consignee}}</span></span>
                        <!--<a class="c-blue ml-30">查看更多 >></a>-->
                    </td>
                </tr>
                </thead>
            </table>
            <div class="line mt-10"></div>
            <div class="cl mt-10">
                <table class="table-hover table_li ml-10  f-l" style="width: 40%;">
                    <thead class="">

                    <tr>
                        <td width="30">
                            <span>客户资质:</span>
                        </td>
                        <td width="50">
                            <span>企业营业执照</span>
                        </td>
                        <td width="20">
                            <span>有</span>
                        </td>
                        <td width="50">
                            <div class="ceshi pic_up">
                                <img title="" width="50" height="50" src="{{=it.group_business_license_addr}}" class="myImg" class="mr-10">
                            </div>
                            <div class="pic_up_btn">
                                <input value="{{=it.group_business_license_addr_short}}" id="fileUp1" style="display: none">
                                <input type="file" class="fileUp"  onchange="putDataToPage(event,this)" multiple="multiple" style="display: none">
                                </input>
                                <a onclick="addBtn(this)" style="margin-left: 20px"><span >上传</span></a>
                            </div>
                        </td>
                    </tr>
                    <tr >
                        <td></td>
                        <td width="50">
                            <span>企业开户许可证:</span>
                        </td>
                        <td width="20">
                            <span>有</span>
                        </td>
                        <td width="50">
                            <div class="ceshi pic_up">
                                <img title="" width="50" height="50" src="{{=it.group_opening_account_addr}}" class="myImg" class="mr-10">
                            </div>
                            <div class="pic_up_btn">
                                <input value="{{=it.group_opening_account_addr_short}}" id="fileUp2" style="display: none">
                                <input type="file" class="fileUp"  onchange="putDataToPage(event,this)" multiple="multiple" style="display: none">
                                </input>
                                <a onclick="addBtn(this)" style="margin-left: 20px"><span >上传</span></a>
                            </div>
                        </td>
                    </tr>
                    <tr >
                        <td></td>
                        <td width="50">
                            <span>企业法人身份证:</span>
                        </td>
                        <td width="20">
                            <span>有</span>
                        </td>
                        <td width="50">
                            <div class="ceshi pic_up">
                                <img title="" width="50" height="50" src="{{=it.group_IDcard_url1}}" class="myImg" class="mr-10">
                            </div>
                            <div class="pic_up_btn">
                                <input value="{{=it.group_IDcard_url1_short}}" id="fileUp3" style="display: none">
                                <input type="file" class="fileUp"  onchange="putDataToPage(event,this)" multiple="multiple" style="display: none">
                                </input>
                                <a onclick="addBtn(this)" style="margin-left: 20px"><span >上传</span></a>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td></td>
                        <td width="50">
                            <span>委托授权书:</span>
                        </td>
                        <td width="20">
                            <span>有</span>
                        </td>
                        <td width="50">
                            <div class="ceshi pic_up">
                                <img title="" width="50" height="50" src="{{=it.group_loa}}" class="myImg" class="mr-10">
                            </div>
                            <div class="pic_up_btn">
                                <input value="{{=it.group_loa_short}}" id="fileUp4" style="display: none">
                                <input type="file" class="fileUp"  onchange="putDataToPage(event,this)" multiple="multiple" style="display: none">
                                </input>
                                <a onclick="addBtn(this)" style="margin-left: 20px"><span >上传</span></a>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td></td>
                        <td width="50">
                            <span>企业logo:</span>
                        </td>
                        <td width="20">
                            <span>有</span>
                        </td>
                        <td width="50">
                            <div class="ceshi pic_up">
                                <img title="" width="50" height="50" src="{{=it.logo}}" class="myImg" id="fileUp5url" class="mr-10">
                            </div>
                            <div class="pic_up_btn">
                                <input value="{{=it.logo}}"  id="fileUp5" style="display: none">
                                <a onclick="logodata(1)" style="margin-left: 20px"><span>上传</span></a>
                            </div>
                        </td>
                    </tr>
                    </thead>
                </table>
                <div class="row f-l table_w50 ml-20 mt-20" >
                    <label class="f-l">备注信息：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <textarea name="abstract" class="textarea"  readonly="readonly" title="不可输入">{{=it.remark}}</textarea>
                    </div>
                </div>
            </div>
            </script>
        </div>
            <div class="pl-10 lh-30 bg-1 pb-10 pt-10 mb-20">
                <span >客户归属: <span id="belGroupId"></span></span>
                <span class="ml-40">营销主管: <span id="groupId_txt"></span></span>
                <div class="row ml-10 f-r mr-50">
                    <label class="form-label  f-l"><span class="c-red">*</span>运营经理：</label>
                    <div class="formControls col-xs-8 f-r"  style="position: relative">
                        <input type="text" class="input-text radius"  name="moli"   placeholder="请选择运营经理" oninput="myFunction()" id="manager" autocomplete="off" >
                        <ul class="relation radius guanlian" id="tuan">
                            <li>无数据</li>
                        </ul>
                    </div>
                </div>
            </div>
        <div class="text-c">
            <input id="bottm" type="submit" type="button" class="btn btn-secondary radius size-S" value="提&nbsp;&nbsp;交">
            <input name="" type="reset" onclick="cancel()" class="btn radius size-S ml-10" value="取&nbsp;&nbsp;消">
        </div>
        <div class="mt-20 text-c mb-20">
            鑫方盛电子商务股份有限公司提供支持
        </div>
    </form>
    <div class="modal-dialog" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" >
        <div class="modal-dialog_lsit" style="width:880px;">
            <div class="modal-content radius">
                <div class="modal-header">
                    <h3 class="modal-title">企业logo编辑</h3>
                    <a onclick="logodata(2)" class="close" data-dismiss="modal" aria-hidden="true" href="javascript:;">×</a>
                </div>
                <div class="modal-body modal-center">
                    <div class="main">
                        <div class="mainLeft" align="center">
                            <span>要求：请使用真实企业图片，图片格式支持JPG,JPEG,GIF,PNG，支持5M 以内的图片</span>
                            <div class="background" >
                                <form name="form" id="uploadImgForm" class="form-horizontal" method="post" enctype="multipart/form-data">
                                    <div class="modal-body text-center">
                                        <div class="zxx_main_con">
                                            <div class="zxx_test_list">
                                                <a href="javascript:;" class="file" style="background-color: #4A90E2; border-color: #4A90E2;color: #fff;margin-right: -37px;cursor:pointer;"><input  style="cursor:pointer;" class="photo-file" type="file" name="file" id="fcupload" onchange="readURL(this);" />选择图片</a>
                                                <input type="hidden" name="isNeetCut" value="10">
                                                <img id = "faceId" src="${pageContext.request.contextPath}/static/img/1.jpg" class="jcrop-preview" width="500">
                                                <!-- 图片长宽高隐藏域 -->
                                                <input type="hidden" id="x" name="x" />
                                                <input type="hidden" id="y" name="y" />
                                                <input type="hidden" id="w" name="w" />
                                                <input type="hidden" id="h" name="h" />
                                                <input type="hidden" id="boundx" name="boundx" >
                                                <input type="hidden" id="boundy" name="boundy" >
                                            </div>
                                        </div>
                                    </div>

                                </form>
                            </div>
                        </div>
                        <div class="mainRight" align="center">
                            <span class="effect" style="margin-right: -32px;">效果预览</span><br>
                            <span class="px" style="margin-right: -32px;">100*100像素</span>
                            <div class="background"  style="margin-right: 100px;" >
                                <div id = "preview_box">
                                    <img id = "lookId" src="../../img/adminImg.png" class="jcrop-preview">
                                </div>

                            </div>
                            <input type="button" id="save" value="确定上传" style="background-color: #4A90E2; border-color: #4A90E2;color: #fff;margin-right: -37px;cursor:pointer;" class="selectPic">

                        </div>
                        <div style="clear:both"></div>
                    </div>
                </div>

            </div>
        </div>
    </div>
</article>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="../../lib/jquery/1.9.1/jquery.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/layer/2.4/layer.js?rev=@@hash"></script>
<script type="text/javascript" src="../../static/h-ui/js/H-ui.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../static/h-ui.admin/js/H-ui.admin.js?rev=@@hash"></script> <!--/_footer 作为公共模版分离出去-->
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="../../lib/My97DatePicker/4.8/WdatePicker.js?rev=@@hash"></script>
<!--表单验证-->
<script type="text/javascript" src="../../lib/jquery.validation/1.14.0/jquery.validate.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/jquery.validation/1.14.0/validate-methods.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/jquery.validation/1.14.0/messages_zh.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/datatables/1.10.0/jquery.dataTables.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/laypage/1.2/laypage.js?rev=@@hash"></script>
<!--企业logo组件-->
<script src="../../ht-js/contract/jquery-form.js?rev=@@hash"></script>
<script src="../../ht-js/contract/jquery.Jcrop.js?rev=@@hash"></script>
<!--log-->
<script src="../../ht-js/frame/doT.min.js?rev=@@hash"></script>
<script src="../../ht-js/public.js?rev=@@hash"></script>
<!--验证token-->
<script src="../../ht-js/verifyToken.js?rev=@@hash"></script>
<!--验证token-->
<script src="../../ht-js/verifyToken.js?rev=@@hash"></script>
<script src="../../ht-js/contract/contr_see.js?rev=@@hash"></script>
<script>
    web.Customerdetails();
    function myFunction(){
        var manager=$("#manager").val();
        var user_data = {
            keywords:manager,
        }
        var succCallBack = function (data, status, response) {
            console.log(data)
            if(data.errorCode=="0"){
                var jsonObj =data.userList;
                if(jsonObj==""){
                    $("#tuan").html("<li>无数据</li> ");
                }else {
                    console.log(jsonObj)
                    var optionstring = "";
                    for (var  i= 0; i < jsonObj.length; i++) {
                        optionstring += "<li onclick='relation("+ jsonObj[i].USER_ID+",\""+jsonObj[i].NAME+"\")' data-align=\"" + jsonObj[i].ROLE_ID + "\" > " + jsonObj[i].NAME + "</li>";
                    }
                    $("#tuan").html(optionstring);
                }
            }else{
                $("#tuan").html("<li>无数据</li> ");
            }
        }
        web.doAjax(root.inter.getOperationManagerByParam,'post',user_data, succCallBack);
    }
    //运营经理获取光标
    $("#manager").focus(function () {
        $("#tuan").show()
    });
    $(document).bind("click",function(e){
        //id为menu的是菜单，id为open的是打开菜单的按钮
        if($(e.target).closest("#tuan").length == 0 && $(e.target).closest("#manager").length == 0){
            //点击id为menu之外且id不是不是open，则触发
            $("#tuan").hide()
        }
    })
    function relation(id,ce){
        $("#manager").val(ce).text(id)
        $("#tuan").hide()
        console.log($("#manager").text())
    }
    //formdata上传图片公用方法
    //触发事件
    function addBtn(cen) {
        $(cen).prev().trigger('click');
    }
    var formData = new FormData();
    // 提交上传图片
    function getupfilerul(can,e){
        console.log(can)
        console.log($("#fileUp1").val)
        var formData = new FormData();
        formData.append('file',$(can)[0].files[0]);
        // formData.append('file',$("#fileUp").files);
        console.log($(can)[0].files[0])
        console.log(formData)
        $.ajax({
            url: root.inter.imgUpload,
            // url:'http://192.168.65.115:8080/contract/approval/imgNewUpload.jhtml',
            cache: false,  //禁用缓存
            type: "POST",
            // 告诉jQuery不要去处理发送的数据
            processData : false,
            // 告诉jQuery不要去设置Content-Type请求头
            contentType : false,
            data: formData,
            success: function (data) {
                for(var i=0; i<data.length; i++){
                    $(can).prev().val(data[0].reletivePath)
                    $(can).prev().text(data[0].reletivePath)
                }
                console.log(data)
            }
        })
    }
    // 上传图片返现
    function putDataToPage(e,can) {
        console.log($("#intro").val())
        for(var i = 0; i < e.target.files.length; i++) {
            var file = e.target.files.item(i);
            if(!(/^image\/.*$/i.test(file.type))) {
                continue; //不是图片 就跳出这一次循环
            }
            //实例化FileReader API
            var freader = new FileReader();
            freader.readAsDataURL(file);
            console.log(e.path)
            console.log(can)
            freader.onload = function (e) {
                console.log(can)
                $(can).parent().prev().children().attr("src", e.target.result);
                console.log(e)
                $(can).next().text('更新')
                getupfilerul(can,e)
            }
        }
        formData.append('file', $(can)[0].files[0]);
    }
    // 企业logo
    /* jcrop对象，全局变量方便操作 */
    var api = null;
    /* 原图宽度 */
    var boundx;
    /* 原图高度 */
    var boundy;
    /* 选择图片事件 */
    function readURL(URL){
        var reader = new FileReader();
        reader.readAsDataURL(URL.files[0]);
        reader.onload = function(e){
            $("#faceId").removeAttr("src");
            $("#lookId").removeAttr("src");
            $("#faceId").attr("src",e.target.result);
            $("#lookId").attr("src",e.target.result);
            $("#faceId").Jcrop({
				setSelect: [ 20, 20, 200, 200 ],
                onChange: showPreview,
                onSelect: showPreview,
                aspectRatio: 1,
                boxWidth:600
            },function(){
                // Use the API to get the real image size
                //使用API来获得真实的图像大小
                var bounds = this.getBounds();
                boundx = bounds[0];
                boundy = bounds[1];
                // Store the API in the jcrop_api variable
                //jcrop_api变量中存储API
                api = this;

                $("#boundx").val(boundx);
                $("#boundy").val(boundy);

            });
        };
        /* 移除jcrop */
        if (api != undefined) {
            api.destroy();
        }

        //简单的事件处理程序，响应自onChange,onSelect事件，按照上面的Jcrop调用
        function showPreview(coords){
            /* 设置剪切参数 */
            $("#x").val(coords.x);
            $("#y").val(coords.y);
            $("#w").val(coords.w);
            $("#h").val(coords.h);
            if(parseInt(coords.w) > 0){
                //计算预览区域图片缩放的比例，通过计算显示区域的宽度(与高度)与剪裁的宽度(与高度)之比得到
                var rx = $("#preview_box").width() / coords.w;
                var ry = $("#preview_box").height() / coords.h;
                $("#lookId").css({
                    width:Math.round(rx * $("#faceId").width()) + "px",    //预览图片宽度为计算比例值与原图片宽度的乘积
                    height:Math.round(rx * $("#faceId").height()) + "px",  //预览图片高度为计算比例值与原图片高度的乘积
                    marginLeft:"-" + Math.round(rx * coords.x) + "px",
                    marginTop:"-" + Math.round(ry * coords.y) + "px"
                });
            }
        }
    }
    $('#save').click(function(){
        $('#uploadImgForm').ajaxSubmit({
            url:'https://'+ window.location.host +'/api/admin/abaseservice/upload',
            type:"post",  //提交方式
            success:function (data) {
                $('.modal-dialog').hide()
                $('#fileUp5url').attr("src", data[0].fullPath);
                $('#fileUp5').val(data[0].fullPath)
                $('#logoingmer').text('更新')
                api.destroy();
                $("#faceId").hide()
                $("#lookId").hide()
                if (data[0].errorCode == 0) {
                    layer.msg('上传成功!', {icon: 6,time:1000});
                }else {
                    layer.msg('上传失败!', {icon: 5,time:1000});
                }
            }
        })
    })
    // 显示隐藏企业logo弹框
    function logodata(data) {
		
		$("#faceId").removeAttr("src");
        $("#lookId").attr("src","../../img/adminImg.png");
        $("#lookId").removeAttr("style");
		$("input[name='file']").val("");
        // var container = $('#form-member-add');
        document.documentElement.scrollTop = 0;
        // $(container).scrollTop(0);
        if(data==1){
            $('.modal-dialog').show()
            return false
        }{
            $('.modal-dialog').hide()
            api.destroy();
            $("#faceId").hide()
            $("#lookId").hide()
        }
    }

</script>
</body>
</html>